<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>货运保险管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		var validateForm;
		function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		$(document).ready(function() {
            //showPolicyTr();
		    <c:if test="${logisInsurePhoto.status1 ne '2'}">
               $("#refusereason1Tr").hide();
			</c:if>
            <c:if test="${logisInsurePhoto.status2 ne '2'}">
            $("#refusereason2Tr").hide();
            </c:if>
            <c:if test="${logisInsurePhoto.status3 ne '2'}">
            $("#refusereason3Tr").hide();
            </c:if>
            <c:if test="${logisInsurePhoto.status4 ne '2'}">
            $("#refusereason4Tr").hide();
            </c:if>
            <c:if test="${logisInsurePhoto.status5 ne '2'}">
            $("#refusereason5Tr").hide();
            </c:if>
		    validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
        //打开对话框(查看)
        function openDialogViewImg(title,url,width,height){
            top.layer.open({
                type: 1,
                title: false,
                offset: ['20px', '20px'],
                shadeClose: true,
                area: ['420px', '360px'], //宽高
                content: '<img src='+url+' width=420px,height=360px>'
            });
        }
        function changeStats(id,value){
            if(value=='2'){
                $("#"+id).show();
			}else{
                $("#"+id).hide();
			}
           // showPolicyTr();
		}

		function showPolicyTr(){
            var status1= $('#status1').val();
            var status2= $('#status2').val();
            var status4= $('#status4').val();
            if(status1=='1'&&status2=='1'&&status4=='1'){
                $('#policyTr').show();
            }
            else{  $('#policyTr').hide();}
		}
	</script>
</head>
<body class="hideScroll">
		<form:form id="inputForm" modelAttribute="logisInsurePhoto" action="${ctx}/logis/logisInsurePhoto/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
		<table class="table table-bordered">
			<tbody>
			<tr><td colspan="7" class="active"><label class="pull-left"><b>1.货物信息</b></label></td></tr>
			<tr><td ><label class="pull-left">货物名称</label></td>
				<td><label class="pull-left">始发地</label></td>
				<td><label class="pull-left">目的地</label></td>
				<td><label class="pull-left">货物图片</label></td>
				<td><label class="pull-left">装车图片</label></td>
				<td><label class="pull-left">发货单</label></td>
				<td width="15%"><label class="pull-left">审核</label></td>

			</tr>
			<tr>
				<td>
						${logisInsurePhoto.goodsName}
				</td>
				<td>
						${logisInsurePhoto.startAddress}
				</td>
				<td>
						${logisInsurePhoto.endAddress}
				</td>
				<td>
					<c:forEach items="${delivery.goodsPicList}" var="goodPic">
						<a  onclick="openDialogViewImg('查看图片', '${goodPic.picUrl}','800px', '500px')">查看</a>
						<a href="${goodPic.picUrl}" download="${goodPic.picUrl}_1">[下载]</a>
					</c:forEach>
					<c:if test="${empty delivery.goodsPicList}">
						未上传
					</c:if>
				</td>
				<td>
					<c:if test="${not empty logisInsurePhoto.pic1}">
						<a  onclick="openDialogViewImg('查看图片', '${logisInsurePhoto.pic1}','800px', '500px')">查看</a>
						<a href="${logisInsurePhoto.pic1}" download="${logisInsurePhoto.id}_1">[下载]</a>
					</c:if>

					<c:if test="${not empty logisInsurePhoto.pic2}">
						<a  onclick="openDialogViewImg('查看图片', '${logisInsurePhoto.pic2}','800px', '500px')">查看</a>
						<a href="${logisInsurePhoto.pic2}" download="${logisInsurePhoto.id}_2">[下载]</a>
					</c:if>
					<c:if test="${not empty logisInsurePhoto.pic3}">
						<a  onclick="openDialogViewImg('查看图片', '${logisInsurePhoto.pic3}','800px', '500px')">查看</a>
						<a href="${logisInsurePhoto.pic3}" download="${logisInsurePhoto.id}_3">[下载]</a>
					</c:if>
					<c:if test="${not empty logisInsurePhoto.pic4}">
						<a  onclick="openDialogViewImg('查看图片', '${logisInsurePhoto.pic4}','800px', '500px')">查看</a>
						<a href="${logisInsurePhoto.pic4}" download="${logisInsurePhoto.id}_4">[下载]</a>
					</c:if>
					<c:if test="${empty logisInsurePhoto.pic1&&empty logisInsurePhoto.pic2 &&empty logisInsurePhoto.pic3&&empty logisInsurePhoto.pic4}">
						未上传
					</c:if>
				</td>
				<td>
                    <!--发货清单pic8-->
					<c:forEach items="${logisInsurePhoto.pics}" var="pic" varStatus="vs">
						<a  onclick="openDialogViewImg('查看图片', '${pic}','800px', '500px')">查看</a>
						<a href="${pic}" download="${logisInsurePhoto.id}_8_${vs.count}">[下载]</a>&nbsp;&nbsp;&nbsp;&nbsp;
					</c:forEach>
					<c:if test="${empty logisInsurePhoto.pics}">
						未上传
					</c:if>
				</td>
				<td>
					<form:select path="status1" class="form-control required" onchange="changeStats('refusereason1Tr',this.value)">
						<form:option value="" label=""/>
						<form:options items="${fns:getDictList('logis_audit_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
			</tr>
			<tr id="refusereason1Tr">
				<td colspan="7" class="text-danger">
					<form:radiobuttons path="refusereason1" items="${fns:getDictList('refusereason1')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks text-danger"/>
				</td>
			</tr>
			</tbody>
		</table>


		<table class="table table-bordered">
		   <tbody>
		   <tr><td colspan="5" class="active"><label class="pull-left"><b>2.受益人信息</b></label></td></tr>
		   <tr>
			   <td><label class="pull-left">受益人姓名</label></td>
			   <td><label class="pull-left">手机</label></td>
			   <td><label class="pull-left">身份证号</label></td>
			   <td><label class="pull-left">身份证件</label></td>
			   <td width="15%"><label class="pull-left">审核</label></td>

		   </tr>
		   <tr>
			   <td>
					   ${logisInsurePhoto.beneficiary}
			   </td>
			   <td>
					   ${logisInsurePhoto.beneficiaryMobile}
			   </td>
			   <td>
					   ${logisInsurePhoto.beneficiaryIdCard}
			   </td>
			   <td>
				   <c:if test="${not empty logisInsurePhoto.idcardImg1}">
					   <a  onclick="openDialogViewImg('查看图片', '${logisInsurePhoto.idcardImg1}','800px', '500px')">查看</a>
					   <a href="${logisInsurePhoto.idcardImg1}" download="${logisInsurePhoto.idcardImg1}_1">[下载]</a>
				   </c:if>
				   <c:if test="${not empty logisInsurePhoto.idcardImg2}">
					   <a  onclick="openDialogViewImg('查看图片', '${logisInsurePhoto.idcardImg2}','800px', '500px')">查看</a>
					   <a href="${logisInsurePhoto.idcardImg2}" download="${logisInsurePhoto.idcardImg2}_1">[下载]</a>
				   </c:if>
				   <c:if test="${empty logisInsurePhoto.idcardImg1 &&empty logisInsurePhoto.idcardImg2}">
					   未上传
				   </c:if>
			   </td>

			   <td>
				   <form:select path="status2" class="form-control required"  onchange="changeStats('refusereason2Tr',this.value)">
					   <form:option value="" label=""/>
					   <form:options items="${fns:getDictList('logis_audit_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				   </form:select>
			   </td>

		   </tr>
		   <tr id="refusereason2Tr">
			   <td colspan="5" class="text-danger">
				   <form:radiobuttons path="refusereason2" items="${fns:getDictList('refusereason2')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks "/>
			   </td>
		   </tr>
		   </tbody>
		</table>
			<table class="table table-bordered">
				<tbody>
		   <tr><td colspan="5" class="active"><label class="pull-left"><b>3.车辆手续审核</b></label></td></tr>
		   <tr>
			   <td><label class="pull-left">车牌</label></td>
			   <td><label class="pull-left">司机姓名</label></td>
			   <td><label class="pull-left">司机身份证号</label></td>
			   <td><label class="pull-left">证件照片</label></td>
			   <td width="15%"><label class="pull-left">审核</label></td>

		   </tr>
		   <tr>

			   <td>
					   ${logisInsurePhoto.licensePlate}
			   </td>
			   <td>
                ${delivery.carrierMobile}
			   </td>
			   <td>

			   </td>

			   <td>
				   <c:if test="${not empty driver.jszImg1}">
					   <a  onclick="openDialogViewImg('查看图片', '${driver.jszImg1}','800px', '500px')">查看</a>
					   <a href="${driver.jszImg1}" download="${driver.id}">[下载]</a>
				   </c:if>

				   <c:if test="${not empty driver.xszImg1}">
					   <a  onclick="openDialogViewImg('查看图片', '${driver.xszImg1}','800px', '500px')">查看</a>
					   <a href="${driver.xszImg1}" download="${driver.id}_2">[下载]</a>
				   </c:if>

				   <c:if test="${not empty logisInsurePhoto.pic5}">
					   <a  onclick="openDialogViewImg('查看图片', '${logisInsurePhoto.pic5}','800px', '500px')">查看</a>
					   <a href="${logisInsurePhoto.pic5}" download="${logisInsurePhoto.id}_5">[下载]</a>
				   </c:if>
				   <c:if test="${not empty logisInsurePhoto.pic6}">
					   <a  onclick="openDialogViewImg('查看图片', '${logisInsurePhoto.pic6}','800px', '500px')">查看</a>
					   <a href="${logisInsurePhoto.pic6}" download="${logisInsurePhoto.id}_6">[下载]</a>
				   </c:if>
				   <c:if test="${not empty logisInsurePhoto.pic7}">
					   <a  onclick="openDialogViewImg('查看图片', '${logisInsurePhoto.pic7}','800px', '500px')">查看</a>
					   <a href="${logisInsurePhoto.pic7}" download="${logisInsurePhoto.id}_7">[下载]</a>
				   </c:if>
				   <c:if test="${not empty logisInsurePhoto.carHeadPic}">
					   <a  onclick="openDialogViewImg('查看图片', '${logisInsurePhoto.carHeadPic}','800px', '500px')">查看</a>
					   <a href="${logisInsurePhoto.carHeadPic}" download="${logisInsurePhoto.id}_8">[下载]</a>
				   </c:if>
				   <c:if test="${not empty logisInsurePhoto.carTailPic}">
					   <a  onclick="openDialogViewImg('查看图片', '${logisInsurePhoto.carTailPic}','800px', '500px')">查看</a>
					   <a href="${logisInsurePhoto.carTailPic}" download="${logisInsurePhoto.id}_9">[下载]</a>
				   </c:if>
				   <c:if test="${empty logisInsurePhoto.pic5 &&empty logisInsurePhoto.pic6 &&empty logisInsurePhoto.pic7}">
					   未上传
				   </c:if>
			   </td>
			   <td>
				   <form:select path="status4" class="form-control required"  onchange="changeStats('refusereason4Tr',this.value)">
					   <form:option value="" label=""/>
					   <form:options items="${fns:getDictList('logis_audit_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				   </form:select>
			   </td>
		   </tr>
		   <tr>
		   <tr id="refusereason4Tr">
			   <td colspan="5" class="text-danger">
				   <form:radiobuttons path="refusereason4" items="${fns:getDictList('refusereason4')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks text-danger"/>
			   </td>
		   </tr>
				</tbody>
			</table>
			<table class="table table-bordered">
				<tbody>

		   <tr id="policyTr">

			   <td class="active"><label class="pull-right">保险单号：</label></td>
			   <td >
				   <form:input path="policyId" htmlEscape="false" placeholder="请输入保单号"   class="form-control"/>
			   </td>
			   <td class="active"><label class="pull-right">(请上传保单)：</label></td>
			   <td >
				   <form:hidden id="policy" path="policy" htmlEscape="false" maxlength="32" class="form-control"/>
				   <sys:ckfinder input="policy" type="files" uploadPath="/logis/insure" selectMultiple="false"/>
			   </td>
		   </tr>
		 	</tbody>
		</table>
	</form:form>
</body>
</html>